concat() support multiple string arguments#200
concat() support multiple string arguments#200margarit-h merged 12 commits intointeg-concat-support-many-argsfrom
concat() support multiple string arguments#200Conversation
Codecov Report
@@ Coverage Diff @@
## integ-concat-support-many-args #200 +/- ##
====================================================================
- Coverage 98.35% 95.94% -2.42%
- Complexity 3609 3624 +15
====================================================================
Files 344 355 +11
Lines 8946 9657 +711
Branches 569 693 +124
====================================================================
+ Hits 8799 9265 +466
- Misses 142 334 +192
- Partials 5 58 +53
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Yury-Fridlyand
left a comment
There was a problem hiding this comment.
Is it possible to replace concat(one, two, three) with concat(one, concat(two, three))? In that case you don't need a vararg function.
core/src/main/java/org/opensearch/sql/expression/function/BuiltinFunctionRepository.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/expression/function/DefaultFunctionResolver.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/expression/function/FunctionDSL.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/expression/function/FunctionDSL.java
Outdated
Show resolved
Hide resolved
| return funcBuilder; | ||
| } | ||
| if (functionResolverMap.get(functionName) instanceof VarargsFunctionResolver) { | ||
| return castArguments(sourceTypes, sourceTypes, funcBuilder); |
There was a problem hiding this comment.
As concat() has variable number of args and targetTypes will always be 0 (as the function signature is not fixed), failure will occur. So, in this case sourceTypes are passed instead of targetTypes to address that.
There was a problem hiding this comment.
There was a problem hiding this comment.
I think a code comment is required to make things clear
concat() support multiple string arguments
concat() support multiple string argumentsconcat() support multiple string arguments
| return funcBuilder; | ||
| } | ||
| if (functionResolverMap.get(functionName) instanceof VarargsFunctionResolver) { | ||
| return castArguments(sourceTypes, sourceTypes, funcBuilder); |
There was a problem hiding this comment.
I think a code comment is required to make things clear
core/src/main/java/org/opensearch/sql/expression/function/FunctionDSL.java
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/expression/function/VarargsFunctionResolver.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
8281bf8 to
82acb60
Compare
#200) * Refactor concat() to support multiple string arguments Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
opensearch-project#1279) * Enable `concat()` string function to support multiple string arguments (#200) Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
opensearch-project#1279) (opensearch-project#1297) * Enable `concat()` string function to support multiple string arguments (#200) Signed-off-by: Margarit Hakobyan <margarit.hakobyan@improving.com> (cherry picked from commit 45fc371) Co-authored-by: Margarit Hakobyan <margarit.hakobyan@improving.com>
#200) Signed-off-by: dblock <dblock@amazon.com> Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: Margarit Hakobyan margarit.hakobyan@improving.com
Description
These changes enable
concat()string function to accept more than two arguments.Usage: CONCAT(str1, str2, ...., str_n) adds two or more strings together.
Argument type: STRING, STRING, ...., STRING
Return type: STRING
Example::
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.